package com.zhu.rtda;

import com.zhu.rtda.heap.InstanceKlass;

//对象模型 ordinary object pointer
public class InstanceOop {
    private InstanceKlass klass;

    private Slot[] fields;

    public InstanceOop(InstanceKlass klass){
        this.klass=klass;
        this.fields=new Slot[klass.getInstanceSlotCount()];
    }

    public InstanceKlass getKlass() {
        return klass;
    }

    public void setKlass(InstanceKlass klass) {
        this.klass = klass;
    }

    public Slot[] getFields() {
        return fields;
    }

    public void setFields(Slot[] fields) {
        this.fields = fields;
    }

    public boolean isInstanceOf(InstanceKlass klass){
        return klass.isAssignableFrom(this.klass);
    }
}
